<%-- Copyright (c) 2005 BroadVision, Inc. All rights reserved              --%>
<%-- The product described in this manual may be protected by one or more  --%>
<%-- U.S. and International patents. The BroadVision One-To-One software   --%>
<%-- is covered by U.S. patent 5,710,887.                                  --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and the BroadVision logo are registered       --%>
<%-- trademarks, and BroadVision One-To-One is a trademark of BroadVision, --%>
<%-- Inc. IONA and Orbix are trademarks of IONA Technologies, Ltd. RSA,    --%>
<%-- MD5, and RC2 are trademarks of RSA Data Security, Inc. All other      --%>
<%-- trademarks, service marks, and trade names belong to their respective --%>
<%-- owners. BroadVision, Inc. disclaims any proprietary interest in the   --%>
<%-- marks and names of others.                                            --%>
<%--                                                                       --%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>

<%@ page import="com.broadvision.emarketing.notification.Constants" %>

<SCRIPT language="javascript1.2">
	
	function doDelete (myform) {
	  result = false;
	  <c:choose>
	    <c:when test='${notifType == "email"}'>
		    okToDelete = confirm("<bean:message bundle="em" 
		                           key="em.notif.emailSummaryView.msg.deleteConfirm"/>");	
	        if (okToDelete) {
		      myform.action='<html:rewrite page="/em/notif/emailDelete.do" />';
		      myform.submit();
		      result = true;
		    }
		</c:when>
	    <c:when test='${notifType == "alert"}'>
		    okToDelete = confirm("<bean:message bundle="em" 
		                           key="em.notif.alertSummaryView.msg.deleteConfirm"/>");	
	        if (okToDelete) {
		      myform.action='<html:rewrite page="/em/notif/alertDelete.do" />';
		      myform.submit();
		      result = true;
		    }
		</c:when>
	  </c:choose>
	  
	  return result;
	}
	
</SCRIPT>


<%-- This holds the current notification type. "email" or "alert". --%>
<c:set var="notifType" value="${notifType}" />

<c:if test='${notifType == "email"}'>
<c:set var="viewBean" value="${emEmailSummaryView}" />
<c:set var="actionPath" value="/em/notif/emailSummaryEdit.do" />
</c:if>

<c:if test='${notifType == "alert"}'>
<c:set var="viewBean" value="${emAlertSummaryView}" />
<c:set var="actionPath" value="/em/notif/alertSummaryEdit.do" />
</c:if>

<c:set var="viewBeanMap" value="${viewBean.map}" />

<!--start zone 5 content area-->

<!--start page title area-->

<table width="100%" border="0" cellspacing="0" cellpadding="0"
       class="zoneFive">
  <tr> 
    <td valign="top" width="100%">
      <div class="pageTitle">
        <c:choose>
        <c:when test='${notifType == "email"}'>      
          <bean:message bundle="em" key="emarketing.notif.emailSummaryView.pageTitle"/>:
        </c:when>
        <c:when test='${notifType == "alert"}'>      
          <bean:message bundle="em" key="em.notif.alertSummaryView.pageTitle"/>:
        </c:when>
        </c:choose>        
        <c:out value="${viewBeanMap.name}" />
      </div>  

      <div class="errorMessage"><html:errors bundle="em"/></div>
      <div><jsp:include page="/mc/common/pagetab.jsp" flush="true" /></div>

      <html-el:form action="${actionPath}">
      <html:hidden name="viewBean" property="oid" />
      <div class="pageSubtitle">
        <span class="left">
        <c:choose>
        <c:when test='${notifType == "email"}'>        
          <bean:message bundle="em" key="emarketing.notif.emailSummaryView.pageSubtitle"/>        
        </c:when>
        <c:when test='${notifType == "alert"}'> 
          <bean:message bundle="em" key="em.notif.alertSummaryView.pageSubtitle"/>        
        </c:when>
        </c:choose>
        </span>
        <span class="right">    
         <!-- if no edit permit, disable edit button   -->
         <c:choose>
           <c:when test='${viewBeanMap.editType}'>
                  <input type="submit" class="inputButton" value="<bean:message bundle="em" key="button.edit" />">
           </c:when>
           <c:otherwise>                     
           </c:otherwise>
         </c:choose>

      
      <!-- if no delete permit, disable delete button  -->
         <c:choose>
           <c:when test='${viewBeanMap.deleteType}'>
                  <input type="button" class="inputButton" value="<bean:message bundle="em" key="button.delete" />"
            onclick="doDelete(this.form);">
           </c:when>
           <c:otherwise>                     
           </c:otherwise>
         </c:choose>
         
          
        </span>
      </div>
      </html-el:form>

      <!--start main content here-->
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="labelForm">
        <tr> 
          <td class="label" width="20%">
          <c:choose>
            <c:when test='${notifType == "email"}'>        
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.name"/>: 
            </c:when>
            <c:when test='${notifType == "alert"}'> 
            <bean:message bundle="em" key="em.notif.alertSummaryEdit.label.name"/>:      
            </c:when>
          </c:choose>          
          </td>
          <td class="labelField" width="80%" >
            <c:out value="${viewBeanMap.name}" />
          </td>
        </tr>
          
        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.description"/>: 
          </td>
          <td class="labelField" width="80%">
            <c:out value="${viewBeanMap.description}" />
          </td>     
        </tr>
        
        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.status"/>: 
          </td>
          <td class="labelField" width="80%">
            <c:choose>
              <c:when test='${viewBeanMap.online}'>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.online" />
              </c:when>
              <c:otherwise>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.offline" />
              </c:otherwise>
            </c:choose>
          </td>     
        </tr>
        
        <tr> 
          <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.lastModified"/>: 
          </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="lastModifiedDate" bundle="mc.messages" formatKey="format.date.medium"/>            
          </td>           
        </tr>
        
        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.deliveryType"/>: 
          </td>
          <td class="labelField" width="80%">
            <c:choose>
              <c:when test='${viewBeanMap.deliveryType == "bv_inbox_delivery"}'>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.inbox" />
              </c:when>
              <c:when test='${viewBeanMap.deliveryType == "bv_email_delivery"}'>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.email" />
              </c:when>
            </c:choose>
          </td>     
        </tr>
        
        <c:if test='${notifType == "alert"}'>
        <tr> 
          <td class="label" width="20%">
            <bean:message bundle="em" key="em.notif.alertSummary.label.alertType"/>: 
          </td>
          <td class="labelField" width="80%">
            <c:out value="${viewBeanMap.alertType}" />
          </td>           
        </tr>
        </c:if>
        
      </table>

      <div class="pageSubtitle">
        <span class="left">
          <bean:message bundle="em" key="emarketing.notif.emailCreate.pageSubtitle.schedule"/>
        </span>
        <span class="right">
        </span>
      </div>
      
      <table class="labelForm" border="0" cellspacing="0" cellpadding="0" summary="Mailing Schedule" width="100%">
        <tr> 
          <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.scheduleType"/>: 
          </td>
          <td class="labelField" width="80%">
            <c:choose>
            <c:when test='${viewBeanMap.scheduleType == "bv_onetime"}'>
              <bean:message bundle="em" key="emarketing.notif.schedule.once"/>
            </c:when>
            <c:when test='${viewBeanMap.scheduleType == "bv_month"}'>
              <bean:message bundle="em" key="emarketing.notif.schedule.monthly"/>
            </c:when>
            <c:when test='${viewBeanMap.scheduleType == "bv_week"}'>
              <bean:message bundle="em" key="emarketing.notif.schedule.weekly"/>
            </c:when>
            <c:when test='${viewBeanMap.scheduleType == "bv_day"}'>
              <bean:message bundle="em" key="emarketing.notif.schedule.daily"/>
            </c:when>
            <c:when test='${viewBeanMap.scheduleType == "bv_hour"}'>
              <bean:message bundle="em" key="emarketing.notif.schedule.hourly"/>
            </c:when>
            </c:choose>
          </td>           
        </tr>
        
        <%-- Always shows start date no matter what schedule type --%>
        <tr> 
          <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.startDate"/>: 
          </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="startDate" bundle="mc.messages" formatKey="format.date.medium"/>
          </td>           
        </tr>
        
        <c:choose>
        <c:when test='${viewBeanMap.scheduleType != "bv_onetime"}'>
		<tr> 
			<td class="label" width="20%">
			  <bean:message bundle="em" key="emarketing.notif.emailCreate.label.endDate"/>:
			</td>
			<td class="labelField" width="80%">
              <bean:write name="viewBean" property="endDate" bundle="mc.messages" formatKey="format.date.medium"/>
			</td>
		</tr>
        </c:when>
        </c:choose>
                
        <c:choose>
        <c:when test='${viewBeanMap.scheduleType == "bv_day"}'>
        <!-- ***** bv_day **** -->        
        <tr>
          <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.deliverMessageAt"/>:
          </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="jobTime" bundle="mc.messages" formatKey="format.time.short"/>            
          </td>
        </tr>
        </c:when>		

        <c:when test='${viewBeanMap.scheduleType == "bv_hour"}'>
		<!-- ***** bv_hour **** -->
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.startTime"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="startDate" bundle="mc.messages" formatKey="format.time.short"/>
          </td>
		</tr>
		
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.endTime"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="endDate" bundle="mc.messages" formatKey="format.time.short"/>
          </td>
		</tr>

		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.frequency"/>:		  
		  </td>
          <td class="labelField" width="80%">
<bean-el:message bundle="em" key="emarketing.notif.emailCreate.label.hourly" arg0="${viewBeanMap.frequency}" />
          </td>
		</tr>
        </c:when>
        
        <c:when test='${viewBeanMap.scheduleType == "bv_onetime"}'>
		<!-- ***** bv_onetime **** -->
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.deliverMessageAt"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="startDate" bundle="mc.messages" formatKey="format.time.short"/>
          </td>
		</tr>
		</c:when>
		
        <c:when test='${viewBeanMap.scheduleType == "bv_week"}'>
		<!-- ***** bv_week **** -->
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.atSpecificDayOfTheWeek"/>:		  
		  </td>
          <td class="labelField" width="80%">
		    <c:forEach var="dayInWeek" items="${viewBeanMap.dayList}" varStatus="status">
		      <c:if test='${dayInWeek == "1"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.monday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "2"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.tuesday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "3"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.wednesday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "4"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.thursday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "5"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.friday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "6"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.saturday"/>&nbsp;
		      </c:if>
		      <c:if test='${dayInWeek == "7"}'>
		        <bean:message bundle="em" key="emarketing.notif.dayofweek.sunday"/>&nbsp;
		      </c:if>
		    </c:forEach>
          </td>
		</tr>
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.deliverMessageAt"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="jobTime" bundle="mc.messages" formatKey="format.time.short"/>
          </td>
		</tr>		
		</c:when>

        <c:when test='${viewBeanMap.scheduleType == "bv_month"}'>
		<!-- ***** bv_month *** -->
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.dayOfMonth"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <c:choose>
              <c:when test='${viewBeanMap.monthDayType == 0}'>
			    <bean:message bundle="em" key="emarketing.notif.emailCreate.label.firstDayOfTheMonth"/>
              </c:when>
              <c:when test='${viewBeanMap.monthDayType == 1}'>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.lastDayOfTheMonth"/>
              </c:when>
              <c:when test='${viewBeanMap.monthDayType == 2}'>
                <bean:message bundle="em" key="emarketing.notif.emailCreate.label.specificDayOfTheMonth"/>:
                <c:out value="${viewBeanMap.monthDay}" />
              </c:when>
            </c:choose>
          </td>
        </tr>
		<tr>
		  <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailCreate.label.deliverMessageAt"/>:		  
		  </td>
          <td class="labelField" width="80%">
            <bean:write name="viewBean" property="jobTime" bundle="mc.messages" formatKey="format.time.short"/>
          </td>
		</tr>		
		</c:when>        	        
        </c:choose>
                
      </table>
      
    </td>
  </tr>
<!--end zone 5 content area-->
</table>




